package com.ssm.xml.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ssm.xml.entity.Directory;
import com.ssm.xml.mapper.DirectoryMapper;
import com.ssm.xml.service.DirectoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DirectoryServiceImpl implements DirectoryService {

    @Autowired
    DirectoryMapper directoryMapper;

    @Override
    public List<Directory> getAllDir() {
        return directoryMapper.selectList(new QueryWrapper<>());
    }

    @Override
    public void addDir(Directory directory) {
        directoryMapper.insert(directory);
    }

    @Override
    public void deleteDir(int id) {
        directoryMapper.deleteById(id);
    }

    @Override
    public void rename(Directory directory) {
        directoryMapper.updateById(directory);
    }
}
